package com.dayaokeji.server_api.api;

import com.dayaokeji.server_api.ServerResponse;
import com.dayaokeji.server_api.domain.DeleteGroup;
import com.dayaokeji.server_api.domain.GroupMember;
import com.dayaokeji.server_api.domain.JoinGroup;
import com.dayaokeji.server_api.domain.CreateGroup;
import com.dayaokeji.server_api.domain.Group;
import com.dayaokeji.server_api.domain.NewCreateGroup;

import java.util.List;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by Gorden on 2017/10/16.
 * 群组相关API
 */

public interface GroupApi {

    /**
     * 群组列表
     * @return
     */
    @POST("course/group/select")
    Call<ServerResponse<List<Group>>> list();

    /**
     * 创建群组
     * @param createGroup
     * @return
     */
    @POST("course/group/create")
    Call<ServerResponse<Void>> create(@Body CreateGroup createGroup);

    @POST("course/group/create")
    Call<ServerResponse<Integer>> newCreate(@Body NewCreateGroup newCreateGroup);

    /**
     * 加入群组
     * @param addGroup
     * @return
     */
    @POST("course/group/addGroupUser")
    Call<ServerResponse<Void>> add(@Body JoinGroup addGroup);

    /**
     * 查询群组用户信息列表
     * @param groupId
     * @return
     */
    @GET("course/group/member")
    Call<ServerResponse<List<GroupMember>>> memberList(@Query("groupId") long groupId);

    /**
     * 修改群组基本信息
     * @param createGroup
     * @return
     */
    @POST("course/group/update")
    Call<ServerResponse<Void>> update(@Body CreateGroup createGroup);

    /**
     * 删除群组
     * @param deleteGroup
     * @return
     */
    @POST("course/group/delete")
    Call<ServerResponse<Void>> delete(@Body DeleteGroup deleteGroup);


    @GET("course/group/selectGroupById")
    Call<ServerResponse<Group>> selectGroupById(@Query("id") long id);

    /**
     * 退出群组
     * @param params
     * @return
     */
    @POST("course/group/existGroup")
    Call<ServerResponse<Void>> existGroup(@Body Map<String,Object> params);
}
